package com.tianqu.tms.www.cardect.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tianqu.tms.core.base.Logger;
import com.tianqu.tms.core.base.TmsAction;
import com.tianqu.tms.core.base.UserContext;
import com.tianqu.tms.core.util.TmsConstants;
import com.tianqu.tms.www.cardect.controller.CarWDPersonNormalDetectTopController;
import com.tianqu.tms.www.cardect.viewhelper.CarNormalDetectViewHelper;
/***
 * 
 * 待检测（人工）基本检测报告录入首页Action
 * 
 * @author tianshifu
 *
 */
public class CarWDPersonNormalDetectTopAction extends TmsAction {
	private Logger logger = Logger.getLogger(CarWDPersonNormalDetectTopAction.class);//log
	private static final String CARSERIAL = "carSerial";
	
	@Override
	protected ActionForward doAction(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response,
			UserContext uc) throws Exception {
		logger.debug(this.getClass().getName() + "#execute was called.");	

		//从前台接收一个车辆ID放在uc中用来保存用
		String carSerial ="";
		if(uc.getAttribute(CARSERIAL)!=null)
		{
			carSerial = (String)uc.getAttribute(CARSERIAL);
			uc.removeAttribute(CARSERIAL);
		}
		else
		{
			carSerial = request.getParameter(CARSERIAL);
		}
		uc.setAttribute(CARSERIAL, carSerial);//将车辆ID放到uc中
		CarWDPersonNormalDetectTopController controller = new CarWDPersonNormalDetectTopController();
		controller.execute(uc);

		
		request.setAttribute(TmsConstants.VIEWHELP, (CarNormalDetectViewHelper)uc.getAttribute(TmsConstants.VIEWHELP));
		logger.debug(this.getClass().getName() + "#doAction was completed.");
		return mapping.findForward(TmsConstants.SUCCESS); 
	}

}
